package com.xxkk.gameCore.global.globalServer;

import com.ebo.synframework.synroom.tools.ConcurrentHashMap;
import com.xxkk.net.websocketNetty.Player;

/**
 * @author xxkk
 * @version 1.0.0
 * @title GameAreaContext
 * @description ʕ•ᴥ•ʔ
 * @create 2023/11/13 15:11
 **/
public class GameAreaContext {
    private final ConcurrentHashMap<Long, Player> logonPlayers = new ConcurrentHashMap<>();// 登陆后的在线玩家存放
    private int areaId;

    public GameAreaContext(int areaId) {
        this.areaId = areaId;
    }

    public int getAreaId() {
        return areaId;
    }

    public void setAreaId(int areaId) {
        this.areaId = areaId;
    }

    public ConcurrentHashMap<Long, Player> getLogonPlayers() {
        return logonPlayers;
    }

    public Player addLogonPlayer(Player player) {
        return this.logonPlayers.put(player.getRoleId(), player);
    }

    public Player rmLogonPlayer(Player player) {
        return this.logonPlayers.remove(player.getRoleId());
    }

}
